package com.example.demo.config;

import lombok.extern.slf4j.Slf4j;
import org.jline.terminal.Terminal;
import org.jline.utils.InfoCmp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.shell.standard.ShellCommandGroup;
import org.springframework.shell.standard.ShellComponent;
import org.springframework.shell.standard.ShellMethod;
import org.springframework.shell.standard.commands.Clear;

@Slf4j
@ShellComponent
@ShellCommandGroup("system ctl")
public class ClearCommand implements Clear.Command{

    @Autowired
    @Lazy
    private Terminal terminal;

    @ShellMethod(value = "clear the shell screen.", key = {"clear", "cls"})
    public void clear() {
        terminal.puts(InfoCmp.Capability.clear_screen);
    }

}



